package com.chapter1;

import java.lang.reflect.Array;
import java.util.Arrays;
import java.util.Scanner;

public class test4 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int[] A = new int[n];
        int[] B = new int[n];
        for(int i = 0; i < n; i++){
            int num = in.nextInt();
            A[i] = factor(num);
        }
        for(int i = 0; i < n; i++){
            int num = in.nextInt();
            B[i] = factor(num);
        }
        Arrays.sort(B);
        Arrays.sort(A);
        int i = 0, j = 0, x = n-1, y = n-1, count=0;
        boolean bLast = true;
        while(bLast){
            if(x == i) bLast = false;
            if(A[x] >B[y]){
                x--;
                y--;
                count++;
            } else if(A[i] >B[j]){
                i++;
                j++;
                count++;
            } else {
                if(A[i] > B[y]){
                    count++;
                }
                i++;
                y--;
            }
        }
        System.out.println(count);
    }

    public static int factor(int num){
        if(num == 1) return 1;
        int count = 2;
        int sq = (int)Math.sqrt(num);
        int r = 0;
        for(int i = 2; i<=sq; i++){
            if(num % i == 0){
                if(i == sq){
                    r = num / i;
                    if(r == i){
                        count++;
                    } else {
                        count += 2;
                    }
                } else {
                    count += 2;
                }
            }
        }
        return count;
    }
}
